﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>移交</title>
    <!--
    1, 退回界面。
    2，需要 FK_Flow, FK_Node,WorkID, FID.
    3, 调用方法 ShiftWork.htm?FK_Flow=001&FK_Node=103&WorkID=232&FID=23
    -->
    
    <link href="../Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" />
    <link href="../Scripts/bootstrap/css/components-rounded.css" rel="stylesheet" />
    <link href="../Scripts/bootstrap/css/font-awesome.css" rel="stylesheet" />
    <link href="../Scripts/bootstrap/css/themes/default/style.min.css" rel="stylesheet" />
    <link href="../Scripts/easyUI145/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../Scripts/layui/layui/css/layui.css" rel="stylesheet" />
    <link href="../Scripts/layui/layui/css/modules/layer/default/layer.css" rel="stylesheet" />
    <script src="../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="../Scripts/QueryString.js"></script>
    <script type="text/javascript" src="../Scripts/bootstrap/js/jquery.min.js"></script>
    <script type="text/javascript" src="../Scripts/bootstrap/js/jquery.cokie.min.js"></script>
    <script type="text/javascript" src="../Scripts/QueryString.js"></script>
    <script type="text/javascript" src="../Scripts/bootstrap/js/bootstrap.min.js"></script>
    <script src="../Scripts/EasyUIUtility.js" type="text/javascript"></script>
    <script src="../Scripts/layui/layui/lay/modules/layer.js"></script>
    <script src="../../DataUser/JSLibData/CommonShowConfig.js"></script>
    <script src="../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../Scripts/QueryString.js" type="text/javascript"></script>
    <script type="text/javascript" src="../Scripts/DealErrInfo.js"></script>

    <link href="../../DataUser/Style/ccbpm.css" rel="Stylesheet" />
    <!-- 导入配置文件. -->
    <script type="text/javascript" src="../Scripts/config.js"></script>
    <script src="../Comm/Gener.js" type="text/javascript"></script>
    <style type="text/css">
        body {
            background: transparent;
            padding: 10px;
            text-align: center;
        }

            body div {
                text-align: left;
            }

        #Message {
            width: 100%;
        }

        .modal-backdrop {
            bottom: 53px;
        }
    </style>
    <script type="text/javascript">
        var param = {};
        $(function () {

            //初始化页面移交页面
            param = {
                FK_Node: GetQueryString('FK_Node'),
                WorkID: GetQueryString('WorkID'),
                FID: GetQueryString('FID'),
                Message: GetQueryString('Info'),
                FK_Flow: GetQueryString("FK_Flow")
            };
            $('#Message').val(param.Message);
            //初始化人员选择窗口
            var selectEmpModalHtml = '<div class="modal fade" id="selectEmpsModal" style="width:60%;height:90%;margin:0 auto;">' +
                '<div class="modal-dialog" style="width:80%;height:80%;">'
                + '<div class="modal-content" style="width:100%;height:100%;">'
                + '<div class="modal-header">'
                + '<button type="button" class="close" style="opacity:1;" data-dismiss="modal" aria-hidden="true">&times;</button>'
                + '<h4 class="modal-title">选择移交人</h4>'
                + '</div>'
                + '<div class="modal-body" style="width:98%;height:88%;">'
                + '<iframe style="width:100%;border:0px;height:100%;" id="iframeSelectEmpsForm" name="iframeSelectEmpsForm"></iframe>'
                + '</div>'
                + '</div><!-- /.modal-content -->'
                + '</div><!-- /.modal-dialog -->'
                + '</div>';

            $('body').append($(selectEmpModalHtml));
            var ccs_fk_dept = getQueryStringByNameFromUrl("?" + $.cookie('CCS'), "FK_Dept");
            if (ccs_fk_dept == null || ccs_fk_dept == '' || ccs_fk_dept == undefined) {
                var u = new WebUser();
                ccs_fk_dept = u.FK_Dept;
            }
            $('#iframeSelectEmpsForm').attr('src', "SelectEmps.htm?FK_Dept=" + ccs_fk_dept + "&FK_Node=" + GetQueryString("FK_Node") + "&s=" + Math.random());

            $('#BtnSelectEmps').bind('click', function () { $('#selectEmpsModal').modal().show(); });
            $("section").show();
            $(".wait").hide();

        });

        //确定  执行移交操作
        function Save() {

            //WorkID, this.FID, this.FK_Node
            var empNos = frames["iframeSelectEmpsForm"].window.returnVal.No;

            if (empNos == "" || empNos == undefined || empNos == null) {
                alert("移交人不能为空");
                return;
            }


            var handler = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt");
            handler.AddUrlData();
            handler.AddPara("ToEmp", empNos);
            handler.AddPara("Message", $('#Message').val());

            var data = handler.DoMethodReturnString("Shift_Save");
            data = data.replace("@null", "");


            if (window.parent != null && window.parent.WindowCloseReloadPage != null && typeof window.parent.WindowCloseReloadPage === "function") {
                window.parent.WindowCloseReloadPage(data);
            } else {
                if (typeof WindowCloseReloadPage != 'undefined' && WindowCloseReloadPage instanceof Function)
                    WindowCloseReloadPage(data);
            }

            $('body').append($('<div>' + data + '</div>'));

            $(".foot").hide();

            setTimeout(function () {
                if (window.parent != null && window.parent.returnWorkWindowClose != null) {
                    window.parent.close();
                    if (window.parent.parent != null && window.parent.parent != undefined)
                        window.parent.parent.close();
                    window.parent.returnWorkWindowClose();
                }
                window.close();

            }, 3000);
            window.close();
        }

        //取消移交
        function Close() {

            if (window.parent != null && window.parent.returnWorkWindowClose != null) {
                window.parent.returnWorkWindowClose("取消");
            } else {
                $('body').append($('<div>' + "已取消操作" + '</div>'));
                window.close();
            }
        }

        //设置选中的人员
        function selectEmpsWindowClose(data) {

            $('#selectEmpsModal').modal('hide');
            if (data == '取消') {
                return;
            }

            $('#ToEmp').val(frames["iframeSelectEmpsForm"].window.returnVal.Name);
        }

        //撤销移交.
        function UnShif() {

        }
    </script>
    <link href="../Scripts/layui/layui/css/layui.css" rel="stylesheet" />

</head>
<body>

    <div style="padding:15px">
        <p style="margin-bottom:10px;">请选择要移交(转办)的人：</p>
        <div style="width:100%;float:left;">
            <!--placeholder="请输入人员编号、名称、简拼、全拼."-->
            <input type="text" id="ToEmp" name="ToEmp" value=''
                   readonly="true"
                   style="width:80%; margin-right:15px; float:left" class="layui-input" />
            <button id="BtnSelectEmps" type="button" class="layui-btn layui-btn-normal" style="float:left">
                选人
            </button>

        </div>
        <br />
        移交原因:
        <textarea name="Message" id="Message" rows="4" style="vertical-align: top; width: 100%;"></textarea>
    </div>
    <div style="position: fixed; bottom: 60px; right: 5px;">
        <button type="button" onclick="Close();" class="layui-btn layui-btn-primary">
           <img src="../Img/Btn/Close.png" />关闭
        </button>
        <button type="button" onclick="Save();" class="layui-btn layui-btn-normal">
            确定移交
        </button>

    </div>
</body>
</html>
